package com.btashov.model;

/**
 * @author Bahtiyar Tashov <btashov@gmail.com>
 */
public class Student {
    private int id;

    //todo: check docs for adding @NotNull
    private String name;

    public Student() {
        if (name == null) name = ""; //maybe not needed
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Student)) return false;

        Student student = (Student) o;
        return id == student.id && name.equals(student.name);
    }

    @Override
    public int hashCode() {
        return 31 * id + name.hashCode();
    }
}
